<template>
  <div class="cart">
    <nav-bar class="nav-bar">
      <template slot="center">购物车({{ cartLength }})</template>
    </nav-bar>
    <scroll class="content" ref="scroll" :probe-type="3" :pullUpLoad="true">
      <cart-list />
    </scroll>
    <cart-bottom-bar />
  </div>
</template>

<script>
import NavBar from "../../components/common/navbar/NavBar.vue";
import { mapGetters } from "vuex";
import CartList from "./childComps/CartList.vue";
import Scroll from "../../components/common/scroll/Scroll.vue";
import CartBottomBar from "./childComps/cartBottomBar.vue";

export default {
  name: "Cart",
  components: {
    NavBar,
    CartList,
    Scroll,
    CartBottomBar,
  },
  computed: {
    ...mapGetters(["cartLength"]),
  },
  activated() {
    console.log("---------");
    this.$refs.scroll.refresh();
  },
};
</script>

<style scoped>
.cart {
  height: 100vh;
}
.nav-bar {
  background-color: var(--color-tint);
  color: #fff;
  z-index: 10;
}
.content {
  height: calc(100% - 44px - 49px);
  overflow: hidden;
}
</style>